from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
import  time
testCase = "DBshop017"
firefox=openBrowser(url)
DBshopLogin(firefox,userName,password)
firefox.find_element_by_link_text('我的订单').click()
firefox.find_element_by_partial_link_text("交易完成").click()
firefox.find_element_by_link_text("尚未评价").click()
firefox.find_element_by_id("comment_body").send_keys('下次还是会回购')
firefox.find_element_by_xpath('//button').click()
firefox.get(urlAdmin)
#调用自定义函数进行后台的登录
DBshopLoginAdmin(firefox)
# 8.进入销售管理订单管理,找到刚才前台提交的订单,点击"编辑查看",再点击付款操作按钮
#调用后台的菜单操作函数
DBshopEnterMenu2(firefox,'商品管理','商品评价')
time.sleep(3)
firefox.find_element_by_link_text("编辑查看").click()
firefox.find_element_by_link_text("评价回复").click()
time.sleep(3)
firefox.find_element_by_id('reply_comment_content').send_keys('谢谢亲的支持和好评')
firefox.find_element_by_xpath('//button[@type="submit"]').click()
try:
     if firefox.find_element_by_xpath('//table//tbody//tr[1]//td[2]').text == '下次还是会回购的':
         writeLog("%s 测试通过" % testCase)
except:
     writeLog("%s 测试失败" % testCase)
     getPhoto(firefox)
firefox.quit()
